import redis


class RedisRead:

    def __init__(self, host, port, password, decode_responses=True):
        self.host = host
        self.port = port
        self.password = password
        self.decode_responses = decode_responses

    def connect(self):
        redis_connect = redis.Redis(host=self.host, port=self.port, password=self.password)
        try:
            redis_connect.ping()
            print("Redis 连接成功！")
        except redis.exceptions.ConnectionError:
            print("Redis连接失败")
